package nkr1pt.popkorn.download;

import com.google.inject.Provider;
import nkr1pt.popkorn.download.DownloadCandidate.Host;
import org.apache.commons.lang.Validate;

/**
 *
 * @author Kristof Vanhaeren
 */
public class DownloadCandidateValidatorProvider implements Provider<DownloadCandidateValidator> {

    private Host host;

    public Host getHost() {
        return host;
    }

    public void setHost(Host host) {
        this.host = host;
    }

    public DownloadCandidateValidator get() {
        Validate.notNull(host, "With host == null, it is impossible to select a validator strategy");

        switch (host) {
            case RAPIDSHARE:
                return new RapidshareValidator();
        }

        return null;
    }

}